package reader_;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author 培培
 * @condition 努力学习中
 */
public class BufferedReader_ {
    public static void main(String[] args) throws IOException {

        String filePath = "d:\\story.txt";

        //创建 BufferedReader 对象
        BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
        //读取
        String line;//按行读取
        //当返回null时，表示文件读取完毕
        while ((line = bufferedReader.readLine()) != null){
            System.out.println(line);
        }

        //关闭流，这里注意，只需要关闭 BufferedReader ，因为底层会自动的去关闭节点流
        bufferedReader.close();
    }
}
